{# Copyright 2016-2017,2020 Siemens AG
   Copyright (c) 2021 LG Electronics Inc.

   Copying and distribution of this file, with or without modification,
   are permitted in any medium without royalty provided the copyright notice and this notice are preserved.
   This file is offered as-is, without any warranty.
#}
{% extends "include/base.html.twig" %}

{% block content %}
{{ parent() }}
<div id="exportList" style="padding-bottom:2em">
  <ul>
    <li><a href="#licenseList">License List</a></li>
    <li><a href="#copyrightList">Copyright List</a></li>
  </ul>
  <div id="licenseList">
    <form method='POST'>
      <ol>
        <li>
          <span>
            {{ "Which agents do you want to include?"|trans }}
          </span>
          <ul>
            <li>
                <label>
                <input type="checkbox" name="agentToInclude_monk" value="yes" {% if agentToInclude_monk %}checked{% endif %}>
                Monk
                </label>
            </li>
            <li>
                <label>
                <input type="checkbox" name="agentToInclude_nomos" value="yes" {% if agentToInclude_nomos %}checked{% endif %}>
                Nomos
                </label>
            </li>
            <li>
                <label>
                <input type="checkbox" name="agentToInclude_ninka" value="yes" {% if agentToInclude_ninka %}checked{% endif %}>
                Ninka
                </label>
            </li>
            <li>
                <label>
                <input type="checkbox" name="agentToInclude_ojo" value="yes" {% if agentToInclude_ojo %}checked{% endif %}>
                Ojo
                </label>
            </li>
            <li>
                <label>
                <input type="checkbox" name="agentToInclude_reportImport" value="yes" {% if agentToInclude_reportImport %}checked{% endif %}>
                Report Import
                </label>
            </li>
          </ul>
        </li>
        <li>
          <label>
            <input type="checkbox" name="doNotIncludeSubfolder" value="yes" {% if not includeSubfolder %}checked{% endif %}>
            Do not include subdirectories?
          </label>
        </li>
        <li>
          <label>
            <input type="checkbox" name="showContainers" value="yes" {% if showContainers %}checked{% endif %}>
            Show directories and containers?
          </label>
        </li>
        <li>
          <label>
            Exclude:
            <input name="exclude" value="{{ exclude|e }}">
            <br/>
            Exclude files containing some substring in the path. 'mac' and it should
            exclude all files and directories containing the substring 'mac'.
          </label>
        </li>
        <li>
          <span>
            {{ "Consolidate Results?"|trans }}
          </span>
          <ul>
            <li>
              <lable>
                <input type="radio" name="consolidate" value="rawResult" {% if rawResult %}checked{% endif %}>
                Print raw result per file.
              </lable>
            </li>
            <li>
              <lable>
                <input type="radio" name="consolidate" value="perFile" {% if perFile %}checked{% endif %}>
                Print consolidated result per file.
              </lable>
            </li>
            <li>
              <lable>
                <input type="radio" name="consolidate" value="perDirectory" {% if perDirectory %}checked{% endif %}>
                Print consolidated result per directory.
              </lable>
            </li>
          </ul>
        </li>
        <li>
          <span>
            {{ "Download License List after creation?"|trans }}
          </span>
          <ul>
            <li>
              <label>
                <input type="radio" name="output" value="noDownload" {% if noDownload %}checked{% endif %}>
                Don't download license list.
              </label>
            </li>
            <li>
              <label>
                <input type="radio" name="output" value="dltext" {% if dltext %}checked{% endif %}>
                Download license list in CSV.
              </label>
            </li>
            <li>
              <label>
                <input type="radio" name="output" value="dlspreadsheet" {% if dlspreadsheet %}checked{% endif %}>
                Download license list in Spreadsheet.
              </label>
            </li>
          </ul>
        </li>
      </ol>
      <input type='submit' value='{{ "Generate list"|trans }}'>
    </form>
  </div>
  <div id="copyrightList">
    <form method='POST'>
      <input type="hidden" name="export_copy" value="yes" />
      <ol>
        <li>
          {{ "Which copyrights to export?"|trans }}
          <ul>
            <li>
              <label>
              <input type="radio" name="copyright_type" value="all" {% if copy_type_all %}checked{% endif %} />
              {{ "All files"|trans }}
              </label>
            </li>
            <li>
              <label>
              <input type="radio" name="copyright_type" value="nolic" {% if copy_type_nolic %}checked{% endif %} />
              {{ "Files without licenses" }}
              </label>
          </ul>
        </li>
        <li>
          <label>
            Exclude:
            <input name="exclude" value="{{ exclude|e }}">
            <br/>
            Exclude files containing some substring in the path. 'mac' and it should
            exclude all files and directories containing the substring 'mac'.
          </label>
        </li>
        <li>
          <label>
            <input type="checkbox" name="output" value="dltext" {% if dltext %}checked{% endif %}>
            Download CSV after creation?
          </label>
        </li>
      </ol>
      <input type='submit' value='{{ "Generate list"|trans }}'>
    </form>
  </div>
</div>
<p>
  With this tool you will only be able to obtain a list with at maximum
  {{ NomostListNum }} entries.
  For a full list run fo_nomos_license_list from the command line.
  This Limit can be modified by the administrator.
</p>
<hr />
{% for warn in warnings %}
  {{ warn }}
{% endfor %}
<pre>
{{ listoutput }}
</pre>
{% endblock %}
{% block foot %}
  {{ parent() }}
  <script src="scripts/jquery.cookie.js" type="text/javascript"></script>

  <script type="text/javascript">
    var exportCookie = 'stickyEmailTab';

    $(document).ready(function() {
      $("#exportList").tabs({
        active: ($.cookie(exportCookie) || {% if export_copy %}1{% else %}0{% endif %}),
        activate: function(e, ui){
          // Get active tab index and update cookie
          var idString = $(e.currentTarget).attr('id');
          idString = parseInt(idString.slice(-1)) - 1;
          $.cookie(exportCookie, idString);
        }
      });
    });
  </script>
{% endblock %}
